package demo.practice.tree;

import demo.practice.TreeNode;

public class Offer27 {

    public TreeNode mirrorTree(TreeNode root) {

        if (root == null)
            return null;

        TreeNode cl = null;
        TreeNode cr = null;
        if (root.left != null) {
            cl = mirrorTree(root.left);

        }

        if (root.right != null) {
            cr = mirrorTree(root.right);
        }

        root.right = cl;
        root.left = cr;

        return root;
    }
}
